package asTest;

import java.util.Random;
import java.util.Scanner;

public class Test {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数:");

        while(sc.hasNextInt()){
            int num = sc.nextInt();
            if(num != 0){
                System.out.println(num+"个空瓶，可以喝"+howMuchWater(num)+"瓶水");
            }
        }
    }

    public static int howMuchWater(int num) {
        if (num == 1 || num == 0) {
            return 0;
        } else if (num == 2) {
            return 1;
        } else {
            return num / 3 + howMuchWater(num % 3 + num / 3);
        }
    }


    @org.junit.Test
    public void  test(){
        int[] arr = new int[8];
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }


}
